UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TeT9pZ1MHh/JP+2iVa411VN6supnMHsjtitUutMejAE='
WHERE
key_id = '27f8e1df80166b017d8bb57059d93cfdacc0feca77d5c6af8b92e645d53a66de'
AND (
token = 'TeT9pZ1MHh/JP+2iVa411VN6supnMHsjtitUutMejAE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)