UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd5wEHFFKPlFCxQva29c9VBICc19YJFK+8qAu/Z16EqE='
WHERE
key_id = 'f81660fa703f91af4a1caf5a715c79975ad3fd22492b533f9e7c14ef66e6b4bd'
AND (
token = 'd5wEHFFKPlFCxQva29c9VBICc19YJFK+8qAu/Z16EqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)