UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FkuH/92mgPHjp4NMvGyftXNSchvYqChTfhjZHlwXhHg=' 
WHERE 
  key_id = '791eca1a9f8ed7d8419312cafee59fb63cc22a952fe62b8671e0c36881254603' 
  AND (
    token = 'FkuH/92mgPHjp4NMvGyftXNSchvYqChTfhjZHlwXhHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031