UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miuCg7NancPY5MJJSIIhHGX/QaJnjvvYEoqpxB3Qwfc=' 
WHERE 
  key_id = '8a9d15e4eba8e93b00d4cd42d5bdc231add070eb37122ef021fe382b08a29b21' 
  AND (
    token = 'miuCg7NancPY5MJJSIIhHGX/QaJnjvvYEoqpxB3Qwfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027