UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fsR67y7PZFXDPNA3S0AhLF9pIJQZwrnUOsSO929TZaw=' 
WHERE 
  key_id = 'f5dc4f2a1e482c1b21bd58ce650c2ebf622585be47d683aceb943b05c35c9e23' 
  AND (
    token = 'fsR67y7PZFXDPNA3S0AhLF9pIJQZwrnUOsSO929TZaw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030