UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQVQBvid0kZe5p3LqtYjKP62Y44ZGYTUP7cLzKvZo6w=' 
WHERE 
  key_id = '8f4d4141a78cb1896fefabe3248c8eb9ecba5ff22fe164dcb438bcfc63223a17' 
  AND (
    token = 'bQVQBvid0kZe5p3LqtYjKP62Y44ZGYTUP7cLzKvZo6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030