UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zTIBDcenSsJFqX+Wwq/iPlRiY9/vK4vD/1ugchgBeIw='
WHERE
key_id = 'bb8a7e90bac919a430f75d92f1f882e2444594fa7651a925cca44c8d260ca61d'
AND (
token = 'zTIBDcenSsJFqX+Wwq/iPlRiY9/vK4vD/1ugchgBeIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)