UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8UJdZuCE0CASNm6YKHyKTx3cSkRnwXOrsIQFNaYlRY=' 
WHERE 
  key_id = '27559ab522032befa4ef75886f86f5c26289745f47708f97e02e4ec55dfa667c' 
  AND (
    token = 'a8UJdZuCE0CASNm6YKHyKTx3cSkRnwXOrsIQFNaYlRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046