UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ivk+Ip8ZVKA4oQ/eqx8HOZmuAD2xgLPzDGDThhMZl4Y='
WHERE
key_id = '765e0bc61e8ffde5bb619e8d5dc85daac4b78ca655861d5a2451f0ca7158eac5'
AND (
token = 'Ivk+Ip8ZVKA4oQ/eqx8HOZmuAD2xgLPzDGDThhMZl4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)