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