UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yRaEZldNbwXtjqhZ49jsSEFPewnSVwPriYlAw0oQSNo='
WHERE
key_id = '1f94d6b02977eb1b0a4dae773515d61f179101bc273f29aec8b221fcf902b333'
AND (
token = 'yRaEZldNbwXtjqhZ49jsSEFPewnSVwPriYlAw0oQSNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)