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