UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bv6c8WJ+TOs9Ux8cFsk1BtJpYlJUEXEVHVo11CqEW9M=' 
WHERE 
  key_id = 'd09eb7e071aad1b3396bacd6e72dad612f8f4ac77801750b2dff0118c6dc6ba9' 
  AND (
    token = 'Bv6c8WJ+TOs9Ux8cFsk1BtJpYlJUEXEVHVo11CqEW9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057