UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXWvUpQcLgmPx1SZ/i1dSrmYfx5mfoNEtl0bnIl3yL0='
WHERE
key_id = '796b07c211dfe2c46ffaee13e73c315471e6cdbba98869a464b6a7d9b5e314cc'
AND (
token = 'CXWvUpQcLgmPx1SZ/i1dSrmYfx5mfoNEtl0bnIl3yL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)