UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'grxYv1o6/2mAHjNF+PMYZRbYoeLe42d+fFK8Y59HP4U='
WHERE
key_id = '1199c704624254cd8164807912e260af8fe8778adaa35c566de95d5732ff95df'
AND (
token = 'grxYv1o6/2mAHjNF+PMYZRbYoeLe42d+fFK8Y59HP4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)