UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oyY8Si+/7+dy3hILHVAEp9Xwi26AWlEYsapmkmtXGf8='
WHERE
key_id = '37e0585f21f8e4654ee23ffb682d63502bea4bfdc57f4a3d2d0b0d523a7ba54d'
AND (
token = 'oyY8Si+/7+dy3hILHVAEp9Xwi26AWlEYsapmkmtXGf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)