UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C0C8G6RALf/o7S+AxKJ4AQ8JTG6GYtpz0NlpiJjph2Y=' 
WHERE 
  key_id = 'b5fbc59de85d3bc974bc9093a96804057b1b93f1664f1ec102894b828b8cc4e9' 
  AND (
    token = 'C0C8G6RALf/o7S+AxKJ4AQ8JTG6GYtpz0NlpiJjph2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043