UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '85SW0vFPUI8NDnWSnFEkKMTbpaAFewmIDfZ2EETwrTw='
WHERE
key_id = 'e89cfa66f042211819f5d239556afef957429664442eeb73c6f093f7c41d3fca'
AND (
token = '85SW0vFPUI8NDnWSnFEkKMTbpaAFewmIDfZ2EETwrTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)