UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ls+3MHNxb73O9CcNSQtgboebYsYY4LuwmtnVGfAca4Y=' 
WHERE 
  key_id = '43f9147df5661a745656f169513207703d6b00ab1715224b3329a33d63effe9b' 
  AND (
    token = 'Ls+3MHNxb73O9CcNSQtgboebYsYY4LuwmtnVGfAca4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039