UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y7/Zku4N1Z7q54WbDczOdqnlXqA5dcjkBqGl8Tzkhn4='
WHERE
key_id = 'e9f7d8b97149ea3ed4a18632cfd35a5d8ee985b101cd9fec9933ba91d17ad628'
AND (
token = 'Y7/Zku4N1Z7q54WbDczOdqnlXqA5dcjkBqGl8Tzkhn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)