UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZjOx3hPEzapKQUWVaCsbaVhTXE+GRCQcTGa1u789yP0='
WHERE
key_id = '000b40c0565f855a2bfb4c55c3bb7cb25297667a3c00305ba4ef7f7128177279'
AND (
token = 'ZjOx3hPEzapKQUWVaCsbaVhTXE+GRCQcTGa1u789yP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)