UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AsbCSxCGwLv6K4BAhjoLWF7PluKGzBEkWLWrGz8tCIg='
WHERE
key_id = 'd069c70996ad576a7e190abbb23dad8ee4f58127ac80bcfd289ff7b65b3a430e'
AND (
token = 'AsbCSxCGwLv6K4BAhjoLWF7PluKGzBEkWLWrGz8tCIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)