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