UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'op3Ol9DpAtNzSLXtUUIFNPA6MLj+IXS0pGrHfD9n4Dg='
WHERE
key_id = 'a9f51b74062bdabf79a530813e32653a4fdd8967bf7bc0f6226403de119932fb'
AND (
token = 'op3Ol9DpAtNzSLXtUUIFNPA6MLj+IXS0pGrHfD9n4Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)