UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PaiPtMR0DCXr4eTa47JgUPqoNwZLoTleoxSWgC5zWYs='
WHERE
key_id = 'c59a1cbe24e265822f8e692008652acddce9d48cc46118a1f9dbb4ee564dd013'
AND (
token = 'PaiPtMR0DCXr4eTa47JgUPqoNwZLoTleoxSWgC5zWYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)