UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zv3zLdkSc903uEcv5boI+xCdYkBEGLiUeu4O6tBxOoI='
WHERE
key_id = 'd76eb1fbdf8cc91d7f36b0c455236948c9d5ccc8a604ce76bb882acd57ea07f0'
AND (
token = 'zv3zLdkSc903uEcv5boI+xCdYkBEGLiUeu4O6tBxOoI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)