UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o6z9nF1p/IrcWMn+rFrxWqfn8PGcKTGNkoyHHDBPcwg=' 
WHERE 
  key_id = '9bfa6f5766e515eea4f3f07748c9230c2ec0edfc3bff19151e5dc271c7b830fc' 
  AND (
    token = 'o6z9nF1p/IrcWMn+rFrxWqfn8PGcKTGNkoyHHDBPcwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038