UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cQKTB0dGEn6Wk5j1JX67MH9S2FFxjGE2/L2uvbbKksQ='
WHERE
key_id = 'd38cda964f7683d415564634b7585e6ee74747232e75585c37f895b991a909b6'
AND (
token = 'cQKTB0dGEn6Wk5j1JX67MH9S2FFxjGE2/L2uvbbKksQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)